/* eslint-disable prettier/prettier */
/* eslint-disable no-unused-vars */
import React from 'react'

const nodes = []
for (let i = 0; i < 3; i++) {
  nodes.push(React.createRef())
}

const active = (node) => {
  nodes.map((val) => {
    if (val === node) {
      if (!val.current.classList.contains('sidebar-item-active')) {
        val.current.classList.add('sidebar-item-active')
      }
    } else {
      val.current.classList.remove('sidebar-item-active')
    }
  })
}

const navTo = (nav, path, node) => {
  nav(path)
  active(node)
}

export { nodes, navTo }
